{% extends "base.html" %}
{% block title %}阅读公文{% endblock %}
{% block content %}
<div class="row justify-content-center align-items-center g-1">
  <div class="col-8 pt-5">
    <div class="card">
      <div class="card-header" style="background-color: #f0f0f0; color: #333; font-weight: bold; padding: 10px;">
        阅读公文
      </div>
      <div class="card-body">
        <div>
          <div class="row mb-3">
            <label class="col-sm-2 col-form-label" style="text-align: right; padding-top: 7px;">标题</label>
            <div class="col-sm-10">
              <input type="text" class="form-control" value="{{ document.title }}" readonly style="border: 1px solid #ccc; border-radius: 4px; background-color: #e9e9e9;">
            </div>
          </div>
          <div class="row mb-3">
            <label class="col-sm-2 col-form-label" style="text-align: right; padding-top: 7px;">内容</label>
            <div class="col-sm-10">
              <textarea class="form-control" rows="6" readonly style="border: 1px solid #ccc; border-radius: 4px; background-color: #e9e9e9;">{{ document.content }}</textarea>
            </div>
          </div>
          <div class="row mb-3">
            <label class="col-sm-2 col-form-label" style="text-align: right; padding-top: 7px;">作者名称</label>
            <div class="col-sm-10">
              <input type="text" class="form-control" value="{{ document.author_name }}" readonly style="background-color: #e9e9e9; border: 1px solid #ccc; border-radius: 4px;">
            </div>
          </div>
          <div class="row mb-3">
            <label class="col-sm-2 col-form-label" style="text-align: right; padding-top: 7px;">发文单位</label>
            <div class="col-sm-10">
              <input type="text" class="form-control" value="{{ document.drafting_unit }}" readonly style="background-color: #e9e9e9; border: 1px solid #ccc; border-radius: 4px;">
            </div>
          </div>
          <div class="row mb-3">
            <label class="col-sm-2 col-form-label" style="text-align: right; padding-top: 7px;">接受单位</label>
            <div class="col-sm-10">
              <input type="text" class="form-control" value="{{ document.receiving_unit }}" readonly style="background-color: #e9e9e9; border: 1px solid #ccc; border-radius: 4px;">
            </div>
          </div>
          <div class="row mb-3">
            <label class="col-sm-2 col-form-label" style="text-align: right; padding-top: 7px;">状态</label>
            <div class="col-sm-10">
              <input type="text" class="form-control" value="{{ document.status }}" readonly style="background-color: #e9e9e9; border: 1px solid #ccc; border-radius: 4px;">
            </div>
          </div>
          <div class="row mb-3">
            <label class="col-sm-2 col-form-label" style="text-align: right; padding-top: 7px;">密级</label>
            <div class="col-sm-10">
              <select class="form-select w-100" disabled style="max-width: 300px; border: 1px solid #ccc; border-radius: 4px; background-color: #e9e9e9;">
                <option value="{{ document.security_level }}">{{ document.security_level }}</option>
              </select>
            </div>
          </div>
          <div class="row mb-3">
            <label class="col-sm-2 col-form-label" style="text-align: right; padding-top: 7px;">最后修改日期</label>
            <div class="col-sm-10">
              <input type="text" class="form-control" value="{{ document.modified_date.strftime('%Y-%m-%d %H:%M:%S') }}" readonly style="background-color: #e9e9e9; border: 1px solid #ccc; border-radius: 4px;">
            </div>
          </div>
                <div class="row mb-3 justify-content-center align-items-center">
            <div class="d-flex justify-content-center" style="width: 100%;">
              <a href="/document" class="btn btn-secondary" style="width: 48%; padding: 8px 12px; border-radius: 4px; cursor: pointer; margin: 0 1%;">
                返回
              </a>
              {% if document.status == '草稿' or document.status == '审核失败' %}
                <a href="{{ url_for('document_edit', id=document.id) }}" class="btn btn-secondary" style="width: 48%; padding: 8px 12px; border-radius: 4px; cursor: pointer; margin: 0 1%;">
                  编辑
                </a>
              {% else %}
                <button class="btn btn-secondary" disabled style="width: 48%; padding: 8px 12px; border-radius: 4px; cursor: not-allowed; margin: 0 1%;">
                  不可编辑
                </button>
              {% endif %}
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}